<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<div fxLayout="row" fxFlex="100">
    @if (showAssetBrowser) {
        <div [fxFlex]="expanded ? browserWidth : '75px'">
            <sp-basic-view [showBackLink]="false">
                <div nav fxLayoutAlign="start center" fxFlex="100">
                    @if (assetBrowserData) {
                        <sp-asset-browser-toolbar
                            fxFlex="100"
                            [assetBrowserData]="assetBrowserData"
                            [expanded]="expanded"
                            (toggleExpanded)="toggleExpanded($event)"
                        >
                        </sp-asset-browser-toolbar>
                    }
                </div>
                @if (assetBrowserData?.assets?.length > 0 && expanded) {
                    <sp-asset-browser-hierarchy
                        [allResourcesAlias]="allResourcesAlias"
                        [assetBrowserData]="assetBrowserData"
                        [assetSelectionMode]="assetSelectionMode"
                        [resourceCount]="resourceCount"
                        [filteredAssetLinkType]="filteredAssetLinkType"
                        (selectedAssetEmitter)="applyAssetFilter($event)"
                        class="asset-hierarchy"
                    >
                    </sp-asset-browser-hierarchy>
                } @else if (
                    assetBrowserData?.assets?.length === 0 && expanded
                ) {
                    <div
                        fxLayoutAlign="center center"
                        fxLayout="column"
                        fxFlex="100"
                    >
                        <span class="asset-creation-hint"
                            >No assets found - use assets to better organize
                            resources!</span
                        >
                        <button
                            mat-button
                            color="accent"
                            class="mt-10"
                            (click)="navigateToAssetManagement()"
                        >
                            Manage assets
                        </button>
                    </div>
                }
                @if (!expanded) {
                    <div
                        *ngIf="!expanded"
                        class="asset-hierarchy asset-browser-text"
                        fxLayoutAlign="center center"
                    >
                        Asset Browser
                    </div>
                }
            </sp-basic-view>
        </div>
    }
    <div fxFlex>
        <ng-content> </ng-content>
    </div>
</div>
